<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@ page import="com.lmpop.trade.ti_admin.*"%>
<%@ page import="com.lmpop.frame.dao.MenuInfo"%>
<%@ page import="com.lmpop.frame.pojo.Menuinfo"%>
<% 
	Map menuinfos = new Hashtable();
	menuinfos.put("subsys_code","SYS");
	menuinfos.put("up_menu_id","000000000000000");
	menuinfos.put("menu_class","1");
 	String role_code = "";
	if(session.getAttribute("session_role_code")!=null && !((String)session.getAttribute("session_role_code")).equals("")){
		role_code = (String)session.getAttribute("session_role_code");
		menuinfos.put("role_code",role_code);
	}
	 String user_type = "";
	if(session.getAttribute("session_user_type")!=null && !((String)session.getAttribute("session_user_type")).equals("")){
		user_type = (String)session.getAttribute("session_user_type");
		menuinfos.put("user_type",user_type);
	}
	  
	String user_id = "";
	if( session.getAttribute("session_user_id") != null )
	{
		user_id = session.getAttribute("session_user_id").toString();
	}
	Ti_adminInfo adminInfo = new Ti_adminInfo();
	String  cust_class =	adminInfo.getCustClassByUserID(user_id);
	if(cust_class != null && !cust_class.equals("")){
	menuinfos.put("cust_class",cust_class);
	}
	
	MenuInfo menuInfo = new MenuInfo();
	
	List menuList = null;

	if(user_type.equals("0")){
		menuList = menuInfo.getListByPage(menuinfos);
	} else if(user_type.equals("1")){
		menuList = menuInfo.getMenuinfoByRole(menuinfos);
	}

	String user_name="";
	user_name=adminInfo.getUserNameByPK(user_id);
	
%>

<html>
  <head>
    
    <title>运营商后台</title>
	<link href="/program/admin/index/css/css.css" rel="stylesheet" type="text/css" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<script type="text/javascript" language="javascript" src="/js/jquery.js"></script>
	<script type="text/javascript">

	function showClassName(){
			document.getElementById('menunav'+0).className = 'active';
		}

	function gourl(val,menu_id){
		var msize = document.getElementById('msize').value;
		for(var i=0;i<msize;i++){
			if(val==i){
				document.getElementById('menunav'+i).className = 'menu-current';
			}else{
				document.getElementById('menunav'+i).className = '';
			}
		}
		window.parent.left.location.href = "left.jsp?menu_id="+menu_id;
	}
	function searchMenu(){
		var top_searchmenu = document.getElementById('top_searchmenu').value;
		if(top_searchmenu=="点击搜索帮助"){
			alert("请输入您要查询的菜单");
			return false;
		}
		if(top_searchmenu!=""&&top_searchmenu.replace(/^\s+|\s+$/g, '')){
			window.parent.main.location.href = "menuList.jsp?menu_name="+top_searchmenu;
		}else{
			alert("请输入您要查询的菜单");
			return false;
		}
		
	}
	</script>

</head>

<body>
    <div class="top">
    <div class="top_t" style="height:auto">
	  
	  <div class="logo f_left">
		 
		  <span><img src="/program/admin/index/images/logo.jpg" /></span>
		  <span class="tc">欢迎回来，<%=user_name%>  <a href="javascript:parent.location.href='/program/login';">[退出]</a></span>
		  <div class="clear"></div>
	  </div>
	
	  
	  <div class="top_r f_right"> 
	  	<!--<p>
			<a href="javascript:parent.location.href='/';">首页</a> | <a href="#">帮助</a> | <a href="#">修改企业信息</a> | <a href="#">修改服务条款 </a>
		</p>-->
        <div class="helpsearch">
        <input type="text" name="top_searchmenu" id="top_searchmenu" class="helpinput" onfocus="if(this.value=='点击搜索帮助')this.value='';" onblur="if(this.value=='')this.value='点击搜索帮助';" value="点击搜索帮助" >
        <input type="button" class="helpbtn"  onclick="searchMenu()" value="搜索">
        
        </div>
        
	 </div>  
	 </div>
	 <div class="clear"></div>
    </div>
	
    <div class="hy">
		<div id="menu-div">
			  <ul>
				 <li class="fix-spacel">&nbsp;</li>
				 <% 
					int msize = 0;
					if(menuList!=null && menuList.size()>0){
						msize = menuList.size();
					
						Hashtable mMap = new Hashtable();
						for(int i=0;i<menuList.size();i++){
							mMap = (Hashtable)menuList.get(i);
							String menu_id = "",menu_name="";
							if(mMap.get("menu_id")!=null) menu_id = mMap.get("menu_id").toString();
							if(mMap.get("menu_name")!=null) menu_name = mMap.get("menu_name").toString();
	 
							String isTop="";
							if(i==0) isTop="menu-current";
							
				%>
				 <li class="<%=isTop%>" id="menunav<%=i%>"><span><a href="#" onClick="gourl('<%=i%>','<%=menu_id%>')"><%=menu_name%></a></span></li>
				 <input type="hidden" name="appear" id="appear" value="<%if(i==0)out.print(i);%>" />
    			 <input type="hidden" name="menu_id" id="menu_id" value="<%=menu_id %>" />
				<%
    					}
    				}
    			%>
				<input type="hidden" name="msize" id="msize" value="<%=msize %>" />

				 
			  </ul>
			  
			  <br class="clear" />
		</div>
    </div>

	
	

</body>

</html>
